#pragma once

#include <engine.core/Logger.hpp>
#include <engine.core/Timer.hpp>
#include <engine.core/info.hpp>

#include "PhysicsDevice.hpp"
#include "TPhysicsActor.hpp"




class TPhysicsDevice : public PhysicsDevice
{
public:

	typedef boost::unordered_set<PhysicsActor*>   Actors;

private:

	LoggerPtr       m_logger;
	Timer           m_timer;

	Actors          m_actors;

	float_t         m_accumulator;

public:

	TPhysicsDevice(const EngineInfo& info);
	~TPhysicsDevice();

	/**
	 * Reports the name of the underlying API this Device uses.
	 */
	QString apiName() const;

private:

	void update();

	RayCastResult rayCast(const ray& ray_) const;
	void debugRender(MeshVertices& vertices, Indices32 &indices) const;

	PhysicsActorPtr TPhysicsDevice::createActor(const ActorDesc& desc);
	void removeActor(PhysicsActor* actor);
};
///////////////////////////////////////////////////////////////////////////////////////////////////
